package org.budo.poi.util;

import org.apache.poi.ss.usermodel.Cell;

import lombok.extern.slf4j.Slf4j;

/**
 * @author limingwei
 */
@Slf4j
public class CellUtil {
    public static Object getCellValue(Cell cell) {
        if (null == cell) {
            log.error("#14 cell=" + cell);
            return null;
        }

        int type = cell.getCellType();
        if (Cell.CELL_TYPE_STRING == type) {
            return cell.getStringCellValue();
        }

        throw new RuntimeException("#22 cell type = " + type);
    }

    public static void setCellValue(Cell cell, Object value) {
        cell.setCellValue((String) value);
    }
}